package com.bx.implatform.controller;

import com.bx.implatform.dto.LoginDTO;
import com.bx.implatform.dto.ModifyPwdDTO;
import com.bx.implatform.dto.RegisterDTO;
import com.bx.implatform.result.Result;
import com.bx.implatform.result.ResultUtils;
import com.bx.implatform.service.UserService;
import com.bx.implatform.vo.LoginVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Tag(name = "注册登录")
@RestController
@RequiredArgsConstructor
public class LoginController {

    private final UserService userService;

    @PostMapping("/login")
    @Operation(summary = "用户登录", description = "用户登录")
    public Result<LoginVO> login(@Valid @RequestBody LoginDTO dto) {
        LoginVO vo = userService.login(dto);
        return ResultUtils.success(vo);
    }

    @PutMapping("/refreshToken")
    @Operation(summary = "刷新token", description = "用refreshtoken换取新的token")
    public Result refreshToken(@RequestHeader("refreshToken") String refreshToken) {
        LoginVO vo = userService.refreshToken(refreshToken);
        return ResultUtils.success(vo);
    }

    @PostMapping("/register")
    @Operation(summary = "用户注册", description = "用户注册")
    public Result register(@Valid @RequestBody RegisterDTO dto) {
        userService.register(dto);
        return ResultUtils.success();
    }

    private List<Map<String, String>> getNameList(){
        List<Map<String, String>> nameMapList = Arrays.asList(
                // === 草帽海贼团 ===
                Map.of("meng_qi_D_lu_fei", "蒙奇·D·路飞"),
                Map.of("luo_luo_nuo_ya_suo_long", "罗罗诺亚·索隆"),
                Map.of("na_mei", "娜美"),
                Map.of("wu_suo_pu", "乌索普"),
                Map.of("shan_zhi", "山治"),
                Map.of("tuo_ni_tuo_ni_qiao_ba", "托尼托尼·乔巴"),
                Map.of("ni_ke_luo_bin", "妮可·罗宾"),
                Map.of("fu_lan_qi", "弗兰奇"),
                Map.of("bu_lu_ke", "布鲁克"),
                Map.of("shen_ping", "甚平"),

                // === 海军 ===
                Map.of("sa_ka_ji_xi_chi_quan", "萨卡斯基（赤犬）"),
                Map.of("ku_zan_qing_zhi", "库赞（青雉）"),
                Map.of("bo_lu_sa_li_nuo_huang_yuan", "波鲁萨利诺（黄猿）"),
                Map.of("yi_xiao_teng_hu", "一笑（藤虎）"),
                Map.of("lü_niu", "绿牛"),
                Map.of("si_mo_ge", "斯摩格"),
                Map.of("da_si_qi", "达斯琪"),
                Map.of("ti_na", "缇娜"),
                Map.of("ke_bi", "克比"),
                Map.of("bei_lu_mei_bo", "贝鲁梅伯"),
                Map.of("zhan_guo", "战国"),
                Map.of("he", "鹤"),
                Map.of("meng_qi_D_ka_pu", "蒙奇·D·卡普"),
                Map.of("ze_fa", "泽法"),
                Map.of("t_bolu_ny", "T·骨"),

                // === 四皇 & 干部 ===
                Map.of("xiang_ke_si", "香克斯"),
                Map.of("ben_beck_man", "本·贝克曼"),
                Map.of("lucky_rou", "拉基·路"),
                Map.of("yasopp", "耶稣布"),
                Map.of("bai_hu_zi", "爱德华·纽盖特（白胡子）"),
                Map.of("ma_er_ke", "马尔科"),
                Map.of("zhuo_bo", "乔兹"),
                Map.of("bi_sha_mi", "比斯塔"),
                Map.of("lin_lin", "夏洛特·玲玲（大妈）"),
                Map.of("ka_takuri", "卡塔库栗"),
                Map.of("si_nian_ji", "斯慕吉"),
                Map.of("ke_la_er", "克力架"),
                Map.of("bu_lin", "布琳"),
                Map.of("kai_duo", "凯多"),
                Map.of("king", "烬"),
                Map.of("queen", "奎因"),
                Map.of("jack", "杰克"),
                Map.of("ma_xie_er_D_di_qi", "马歇尔·D·蒂奇（黑胡子）"),
                Map.of("zhi_liu", "芝沙斯·巴沙斯"),
                Map.of("fan_ao_ka", "范·奥卡"),

                // === 七武海 ===
                Map.of("bo_ya_han_ku_ke", "波雅·汉库克（女帝）"),
                Map.of("mi_hawk", "乔拉可尔·米霍克（鹰眼）"),
                Map.of("duo_fu_lang_ming_ge", "唐吉诃德·多弗朗明哥"),
                Map.of("ba_ji", "巴基"),
                Map.of("ke_lo_ke_da_er", "克洛克达尔（沙鳄鱼）"),
                Map.of("mo_li_ya", "月光·莫利亚"),
                Map.of("ji_huo_er", "甚平（原七武海）"),
                Map.of("luo", "特拉法尔加·罗"),

                // === 革命军 ===
                Map.of("meng_qi_D_long", "蒙奇·D·龙"),
                Map.of("sa_bo", "萨博"),
                Map.of("ke_la_er", "克拉尔"),
                Map.of("yi_wan", "伊万科夫"),
                Map.of("bei_li", "贝洛·贝蒂"),

                // === 超新星 ===
                Map.of("ji_de", "尤斯塔斯·基德"),
                Map.of("ji_la", "基拉"),
                Map.of("huo_jin_si", "巴兹尔·霍金斯"),
                Map.of("a_pu", "斯库拉奇曼·阿普"),
                Map.of("de_lei_ke", "X·德雷克"),
                Map.of("wu_er_ji", "乌尔基"),
                Map.of("bei_bo", "贝波（罗的船员）"),
                Map.of("kai_li", "卡里布"),

                // === CP组织 ===
                Map.of("luo_bu_lu_qi", "罗布·路奇"),
                Map.of("ka_ku", "卡库"),
                Map.of("ka_li_fa", "卡莉法"),
                Map.of("bu_lu_nuo", "布鲁诺"),
                Map.of("jia_bu_la", "加布拉"),

                // === 和之国 ===
                Map.of("guang_yue_ri_he", "光月日和"),
                Map.of("tao_zhi_zhu", "桃之助"),
                Map.of("da_he", "大和"),
                Map.of("he_dao_yi_zang", "河童河松"),
                Map.of("ji_zang", "传次郎（狂死郎）"),
                Map.of("xiao_ju", "小玉"),
                Map.of("shou_he", "霜月牛丸"),

                // === 鱼人岛 ===
                Map.of("bai_xing", "尼普顿"),
                Map.of("sha_xing", "鲨星"),
                Map.of("fan_li", "范德·戴肯九世"),
                Map.of("a_long", "阿龙"),
                Map.of("xiao_ba", "小八"),

                // === 空岛 ===
                Map.of("ai_ni_lu", "艾尼路"),
                Map.of("gan_fu_er", "甘·福尔"),
                Map.of("wei_bo", "韦柏"),

                // === 德雷斯罗萨 ===
                Map.of("lei_ou", "蕾贝卡"),
                Map.of("li_ke_wang", "力库王"),
                Map.of("ju_ran_zi", "居鲁士"),
                Map.of("bai_ma", "白马·卡文迪许"),

                // === 其他势力 ===
                Map.of("pei_luo_na", "佩罗娜"),
                Map.of("ao_zi", "奥兹"),
                Map.of("fu_ke_xi", "福克西"),
                Map.of("ba_te_luo_miao", "巴托洛米奥"),
                Map.of("lei_bei_ka", "蕾贝卡"),
                Map.of("wei_wei", "薇薇"),
                Map.of("ke_la_bai_er", "寇布拉"),
                Map.of("yi_ka_lai_mu", "伊卡莱姆"),
                Map.of("tom", "汤姆"),
                Map.of("bing_shan", "冰山"),
                Map.of("ba_li", "巴里"),

                // === 补充角色（凑满200）===
                Map.of("daz_bo_ss", "达兹·波尼斯（Mr.1）"),
                Map.of("miss_double_finger", "Miss.双手指"),
                Map.of("mr_2", "冯·克雷（Mr.2）"),
                Map.of("mr_3", "加尔迪诺（Mr.3）"),
                Map.of("miss_goldenweek", "Miss.黄金周"),
                Map.of("hachi", "哈蒙德"),
                Map.of("kuroobi", "克罗欧比"),
                Map.of("chew", "啾"),
                Map.of("arlong", "恶龙"),
                Map.of("bellmere", "贝尔梅尔"),
                Map.of("nojiko", "诺琪高"),
                Map.of("vivi", "薇薇"),
                Map.of("cobra", "寇布拉"),
                Map.of("chaka", "加卡"),
                Map.of("pell", "贝尔"),
                Map.of("koza", "寇沙"),
                Map.of("wapol", "瓦波尔"),
                Map.of("dalton", "多尔顿"),
                Map.of("kureha", "古蕾娃"),
                Map.of("hiriluk", "希鲁鲁克"),
                Map.of("wiper", "韦柏"),
                Map.of("laki", "拉琪"),
                Map.of("conis", "柯尼斯"),
                Map.of("pagu", "派葛亚"),
                Map.of("gedatsu", "盖达兹"),
                Map.of("ohm", "欧姆"),
                Map.of("shura", "修罗"),
                Map.of("satori", "大悟"),
                Map.of("hotori", "中悟"),
                Map.of("kotori", "小悟"),
                Map.of("foxy", "福克西"),
                Map.of("porche", "波琪"),
                Map.of("hamburg", "汉堡"),
                Map.of("big_pan", "比格潘"),
                Map.of("kokoro", "可可罗"),
                Map.of("chimney", "奇姆尼"),
                Map.of("gonbe", "昆贝"),
                Map.of("paulie", "包利"),
                Map.of("tilestone", "戴鲁斯通"),
                Map.of("robin", "罗宾（童年）"),
                Map.of("spandam", "斯潘达姆"),
                Map.of("kumadori", "偎取"),
                Map.of("fukuro", "猫头鹰"),
                Map.of("jabra", "加布拉"),
                Map.of("kalifa", "卡莉法"),
                Map.of("blueno", "布鲁诺"),
                Map.of("kaku", "卡库"),
                Map.of("lucci", "罗布·路奇"),
                Map.of("hogback", "霍古巴克"),
                Map.of("absalom", "阿布萨罗姆"),
                Map.of("perona", "佩罗娜"),
                Map.of("moria", "月光·莫利亚"),
                Map.of("oz", "奥兹"),
                Map.of("lola", "罗拉"),
                Map.of("ryuma", "龙马"),
                Map.of("brook_alive", "布鲁克（生前）"),
                Map.of("shakky", "夏琪"),
                Map.of("rayleigh", "雷利"),
                Map.of("hancock", "波雅·汉库克"),
                Map.of("sandersonia", "波雅·桑达索尼娅"),
                Map.of("marigold", "波雅·玛丽哥鲁德"),
                Map.of("law", "特拉法尔加·罗"),
                Map.of("bepo", "贝波"),
                Map.of("shachi", "夏奇"),
                Map.of("penguin", "佩金"),
                Map.of("kid", "尤斯塔斯·基德"),
                Map.of("killer", "基拉"),
                Map.of("hawkins", "巴兹尔·霍金斯"),
                Map.of("apoo", "斯库拉奇曼·阿普"),
                Map.of("drake", "X·德雷克"),
                Map.of("urouge", "乌尔基"),
                Map.of("bonney", "乔艾莉·波妮"),
                Map.of("caribou", "卡里布"),
                Map.of("coribou", "克里布"),
                Map.of("hody_jones", "霍迪·琼斯"),
                Map.of("zeo", "杰欧"),
                Map.of("daru", "达摩"),
                Map.of("hyouzou", "豹藏"),
                Map.of("dosun", "多森"),
                Map.of("shirahoshi", "白星"),
                Map.of("fukaboshi", "鲨星"),
                Map.of("ryuboshi", "皇星"),
                Map.of("manboshi", "翻车星"),
                Map.of("vander_decken", "范德·戴肯九世"),
                Map.of("wadatsumi", "秃头海怪"),
                Map.of("caesar_clown", "凯撒·库朗"),
                Map.of("monet", "莫奈"),
                Map.of("vergo", "维尔戈"),
                Map.of("buffalo", "巴法罗"),
                Map.of("baby_5", "Baby-5"),
                Map.of("senor_pink", "塞尼奥尔·皮克"),
                Map.of("dellinger", "德林杰"),
                Map.of("gladius", "古拉迪乌斯"),
                Map.of("diamante", "迪亚曼蒂"),
                Map.of("trebol", "托雷波尔"),
                Map.of("sugar", "砂糖"),
                Map.of("pica", "琵卡"),
                Map.of("doflamingo", "多弗朗明哥"),
                Map.of("kyros", "居鲁士"),
                Map.of("rebecca", "蕾贝卡"),
                Map.of("scarlet", "斯卡莱特"),
                Map.of("rikky", "力库王"),
                Map.of("viola", "维奥莱特"),
                Map.of("bartolomeo", "巴托洛米奥"),
                Map.of("gambia", "甘比亚"),
                Map.of("leo", "雷欧"),
                Map.of("tontatta", "小人族"),
                Map.of("sai", "蔡"),
                Map.of("boo", "老蔡"),
                Map.of("hajrudin", "哈鲁丁"),
                Map.of("jeet", "杰特"),
                Map.of("abdullah", "阿布德拉"),
                Map.of("ideo", "伊迪欧"),
                Map.of("blue_gilly", "布鲁基利"),
                Map.of("chinjao", "青椒"),
                Map.of("cavendish", "卡文迪许"),
                Map.of("suleiman", "苏莱曼"),
                Map.of("orlumbus", "奥尔隆布斯"),
                Map.of("mcguy", "麦克盖伊"),
                Map.of("lucky_roux", "拉基·路"),
                Map.of("yasopp", "耶稣布"),
                Map.of("lucky_roo", "拉基·路"),
                Map.of("shanks", "香克斯"),
                Map.of("ben_beckman", "本·贝克曼"),
                Map.of("lucky_rou", "拉基·路"),
                Map.of("rockstar", "洛克之星"),
                Map.of("howling_gab", "嚎叫的加布"),
                Map.of("building_snake", "建筑蛇"),
                Map.of("monster", "怪物"),
                Map.of("van_augur", "范·奥卡"),
                Map.of("doc_q", "毒Q"),
                Map.of("jesus_burgess", "芝沙斯·巴沙斯"),
                Map.of("laffitte", "拉菲特"),
                Map.of("avalo_pizarro", "阿瓦罗·皮萨罗"),
                Map.of("shiryu", "希留"),
                Map.of("vasco_shot", "巴斯克·乔特"),
                Map.of("san_juan_wolf", "圣胡安·恶狼"),
                Map.of("catarina_devon", "卡特琳娜·戴彭"),
                Map.of("kuzan", "库赞"),
                Map.of("sakazuki", "萨卡斯基"),
                Map.of("kizaru", "波鲁萨利诺"),
                Map.of("fujitora", "一笑"),
                Map.of("ryokugyu", "绿牛"),
                Map.of("smoker", "斯摩格"),
                Map.of("tashigi", "达斯琪"),
                Map.of("hina", "缇娜"),
                Map.of("koby", "克比"),
                Map.of("helmeppo", "贝鲁梅伯"),
                Map.of("sengoku", "战国"),
                Map.of("tsuru", "鹤"),
                Map.of("garp", "蒙奇·D·卡普"),
                Map.of("aokiji", "库赞"),
                Map.of("akainu", "萨卡斯基"),
                Map.of("kuma", "巴索罗缪·熊"),
                Map.of("ivankov", "伊万科夫"),
                Map.of("inazuma", "闪电"),
                Map.of("sabo", "萨博"),
                Map.of("koala", "克拉尔"),
                Map.of("hack", "哈库"),
                Map.of("betty", "贝洛·贝蒂"),
                Map.of("karasu", "乌鸦"),
                Map.of("lindbergh", "林德伯格"),
                Map.of("morley", "莫里"),
                Map.of("dragon", "蒙奇·D·龙"),
                Map.of("kuma_pacifista", "和平主义者熊"),
                Map.of("sentomaru", "战桃丸"),
                Map.of("pacifista", "和平主义者"),
                Map.of("stussy", "斯图西"),
                Map.of("shiki", "金狮子史基"),
                Map.of("morgan", "摩根"),
                Map.of("neptune", "尼普顿"),
                Map.of("shirahoshi", "白星"),
                Map.of("fukaboshi", "鲨星"),
                Map.of("ryuboshi", "皇星"),
                Map.of("manboshi", "翻车星"),
                Map.of("hody_jones", "霍迪·琼斯"),
                Map.of("zeo", "杰欧"),
                Map.of("daruma", "达摩"),
                Map.of("hyouzou", "豹藏"),
                Map.of("dosun", "多森"),
                Map.of("shyarly", "夏莉"),
                Map.of("camie", "凯米"),
                Map.of("pappug", "帕帕古"),
                Map.of("hachi", "小八"),
                Map.of("kuroobi", "克罗欧比"),
                Map.of("chew", "啾"),
                Map.of("arlong", "恶龙"),
                Map.of("bellmere", "贝尔梅尔"),
                Map.of("nojiko", "诺琪高"),
                Map.of("vivi", "薇薇"),
                Map.of("cobra", "寇布拉"),
                Map.of("chaka", "加卡"),
                Map.of("pell", "贝尔"),
                Map.of("koza", "寇沙"),
                Map.of("wapol", "瓦波尔"),
                Map.of("dalton", "多尔顿"),
                Map.of("kureha", "古蕾娃"),
                Map.of("hiriluk", "希鲁鲁克"),
                Map.of("chopper", "乔巴"),
                Map.of("wiper", "韦柏"),
                Map.of("laki", "拉琪"),
                Map.of("conis", "柯尼斯"),
                Map.of("pagu", "派葛亚"),
                Map.of("gedatsu", "盖达兹"),
                Map.of("ohm", "欧姆"),
                Map.of("shura", "修罗"),
                Map.of("satori", "大悟"),
                Map.of("hotori", "中悟"),
                Map.of("kotori", "小悟"),
                Map.of("foxy", "福克西"),
                Map.of("porche", "波琪"),
                Map.of("hamburg", "汉堡"),
                Map.of("big_pan", "比格潘"),
                Map.of("kokoro", "可可罗"),
                Map.of("chimney", "奇姆尼"),
                Map.of("gonbe", "昆贝"),
                Map.of("paulie", "包利"),
                Map.of("tilestone", "戴鲁斯通"),
                Map.of("robin", "罗宾（童年）"),
                Map.of("spandam", "斯潘达姆"),
                Map.of("kumadori", "偎取"),
                Map.of("fukuro", "猫头鹰"),
                Map.of("jabra", "加布拉"),
                Map.of("kalifa", "卡莉法"),
                Map.of("blueno", "布鲁诺"),
                Map.of("kaku", "卡库"),
                Map.of("lucci", "罗布·路奇"),
                Map.of("hogback", "霍古巴克"),
                Map.of("absalom", "阿布萨罗姆"),
                Map.of("perona", "佩罗娜"),
                Map.of("moria", "月光·莫利亚"),
                Map.of("oz", "奥兹"),
                Map.of("lola", "罗拉"),
                Map.of("ryuma", "龙马"),
                Map.of("brook_alive", "布鲁克（生前）"),
                Map.of("shakky", "夏琪"),
                Map.of("rayleigh", "雷利"),
                Map.of("hancock", "波雅·汉库克"),
                Map.of("sandersonia", "波雅·桑达索尼娅"),
                Map.of("marigold", "波雅·玛丽哥鲁德"),
                Map.of("law", "特拉法尔加·罗"),
                Map.of("bepo", "贝波"),
                Map.of("shachi", "夏奇"),
                Map.of("penguin", "佩金"),
                Map.of("kid", "尤斯塔斯·基德"),
                Map.of("killer", "基拉"),
                Map.of("hawkins", "巴兹尔·霍金斯"),
                Map.of("apoo", "斯库拉奇曼·阿普"),
                Map.of("drake", "X·德雷克"),
                Map.of("urouge", "乌尔基"),
                Map.of("bonney", "乔艾莉·波妮"),
                Map.of("caribou", "卡里布"),
                Map.of("coribou", "克里布"),
                Map.of("hody_jones", "霍迪·琼斯"),
                Map.of("zeo", "杰欧"),
                Map.of("daru", "达摩"),
                Map.of("hyouzou", "豹藏"),
                Map.of("dosun", "多森"),
                Map.of("shirahoshi", "白星"),
                Map.of("fukaboshi", "鲨星"),
                Map.of("ryuboshi", "皇星"),
                Map.of("manboshi", "翻车星"),
                Map.of("vander_decken", "范德·戴肯九世"),
                Map.of("wadatsumi", "秃头海怪"),
                Map.of("caesar_clown", "凯撒·库朗"),
                Map.of("monet", "莫奈"),
                Map.of("vergo", "维尔戈"),
                Map.of("buffalo", "巴法罗"),
                Map.of("baby_5", "Baby-5"),
                Map.of("senor_pink", "塞尼奥尔·皮克"),
                Map.of("dellinger", "德林杰"),
                Map.of("gladius", "古拉迪乌斯"),
                Map.of("diamante", "迪亚曼蒂"),
                Map.of("trebol", "托雷波尔"),
                Map.of("sugar", "砂糖"),
                Map.of("pica", "琵卡"),
                Map.of("doflamingo", "多弗朗明哥"),
                Map.of("kyros", "居鲁士"),
                Map.of("rebecca", "蕾贝卡"),
                Map.of("scarlet", "斯卡莱特"),
                Map.of("rikky", "力库王"),
                Map.of("viola", "维奥莱特"),
                Map.of("bartolomeo", "巴托洛米奥"),
                Map.of("gambia", "甘比亚"),
                Map.of("leo", "雷欧"),
                Map.of("tontatta", "小人族"),
                Map.of("sai", "蔡"),
                Map.of("boo", "老蔡"),
                Map.of("hajrudin", "哈鲁丁"),
                Map.of("jeet", "杰特"),
                Map.of("abdullah", "阿布德拉"),
                Map.of("ideo", "伊迪欧"),
                Map.of("blue_gilly", "布鲁基利"),
                Map.of("chinjao", "青椒"),
                Map.of("cavendish", "卡文迪许"),
                Map.of("suleiman", "苏莱曼"),
                Map.of("orlumbus", "奥尔隆布斯"),
                Map.of("mcguy", "麦克盖伊"),
                Map.of("lucky_roux", "拉基·路"),
                Map.of("yasopp", "耶稣布"),
                Map.of("lucky_roo", "拉基·路"),
                Map.of("shanks", "香克斯"),
                Map.of("ben_beckman", "本·贝克曼"),
                Map.of("lucky_rou", "拉基·路"),
                Map.of("rockstar", "洛克之星"),
                Map.of("howling_gab", "嚎叫的加布"),
                Map.of("building_snake", "建筑蛇"),
                Map.of("monster", "怪物"),
                Map.of("van_augur", "范·奥卡"),
                Map.of("doc_q", "毒Q"),
                Map.of("jesus_burgess", "芝沙斯·巴沙斯"),
                Map.of("laffitte", "拉菲特"),
                Map.of("avalo_pizarro", "阿瓦罗·皮萨罗"),
                Map.of("shiryu", "希留"),
                Map.of("vasco_shot", "巴斯克·乔特"),
                Map.of("san_juan_wolf", "圣胡安·恶狼"),
                Map.of("catarina_devon", "卡特琳娜·戴彭"),
                Map.of("kuzan", "库赞"),
                Map.of("sakazuki", "萨卡斯基"),
                Map.of("kizaru", "波鲁萨利诺"),
                Map.of("fujitora", "一笑"),
                Map.of("ryokugyu", "绿牛"),
                Map.of("smoker", "斯摩格"),
                Map.of("tashigi", "达斯琪"),
                Map.of("hina", "缇娜"),
                Map.of("koby", "克比"),
                Map.of("helmeppo", "贝鲁梅伯"),
                Map.of("sengoku", "战国"),
                Map.of("tsuru", "鹤"),
                Map.of("garp", "蒙奇·D·卡普"),
                Map.of("aokiji", "库赞"),
                Map.of("akainu", "萨卡斯基"),
                Map.of("kuma", "巴索罗缪·熊"),
                Map.of("ivankov", "伊万科夫"),
                Map.of("inazuma", "闪电"),
                Map.of("sabo", "萨博"),
                Map.of("koala", "克拉尔"),
                Map.of("hack", "哈库"),
                Map.of("betty", "贝洛·贝蒂"),
                Map.of("karasu", "乌鸦"),
                Map.of("lindbergh", "林德伯格"),
                Map.of("morley", "莫里"),
                Map.of("dragon", "蒙奇·D·龙"),
                Map.of("kuma_pacifista", "和平主义者熊"),
                Map.of("sentomaru", "战桃丸"),
                Map.of("pacifista", "和平主义者"),
                Map.of("stussy", "斯图西"),
                Map.of("shiki", "金狮子史基"),
                Map.of("morgan", "摩根"),
                Map.of("neptune", "尼普顿"),
                Map.of("shirahoshi", "白星"),
                Map.of("fukaboshi", "鲨星"),
                Map.of("ryuboshi", "皇星"),
                Map.of("manboshi", "翻车星"),
                Map.of("hody_jones", "霍迪·琼斯"),
                Map.of("zeo", "杰欧"),
                Map.of("daruma", "达摩"),
                Map.of("hyouzou", "豹藏"),
                Map.of("dosun", "多森"),
                Map.of("shyarly", "夏莉"),
                Map.of("camie", "凯米"),
                Map.of("pappug", "帕帕古"),
                Map.of("hachi", "小八"),
                Map.of("kuroobi", "克罗欧比"),
                Map.of("chew", "啾"),
                Map.of("arlong", "恶龙"),
                Map.of("bellmere", "贝尔梅尔"),
                Map.of("nojiko", "诺琪高"),
                Map.of("vivi", "薇薇"),
                Map.of("cobra", "寇布拉"),
                Map.of("chaka", "加卡"),
                Map.of("pell", "贝尔"),
                Map.of("koza", "寇沙"),
                Map.of("wapol", "瓦波尔"),
                Map.of("dalton", "多尔顿"),
                Map.of("kureha", "古蕾娃"),
                Map.of("hiriluk", "希鲁鲁克"),
                Map.of("chopper", "乔巴"),
                Map.of("wiper", "韦柏"),
                Map.of("laki", "拉琪"),
                Map.of("conis", "柯尼斯"),
                Map.of("pagu", "派葛亚"),
                Map.of("gedatsu", "盖达兹"),
                Map.of("ohm", "欧姆"),
                Map.of("shura", "修罗"),
                Map.of("satori", "大悟"),
                Map.of("hotori", "中悟"),
                Map.of("kotori", "小悟"),
                Map.of("foxy", "福克西"),
                Map.of("porche", "波琪"),
                Map.of("hamburg", "汉堡"),
                Map.of("big_pan", "比格潘"),
                Map.of("kokoro", "可可罗"),
                Map.of("chimney", "奇姆尼"),
                Map.of("gonbe", "昆贝"),
                Map.of("paulie", "包利"),
                Map.of("tilestone", "戴鲁斯通"),
                Map.of("robin", "罗宾（童年）"),
                Map.of("spandam", "斯潘达姆"),
                Map.of("kumadori", "偎取"),
                Map.of("fukuro", "猫头鹰"),
                Map.of("jabra", "加布拉"),
                Map.of("kalifa", "卡莉法"),
                Map.of("blueno", "布鲁诺"),
                Map.of("kaku", "卡库"),
                Map.of("lucci", "罗布·路奇"),
                Map.of("hogback", "霍古巴克"),
                Map.of("absalom", "阿布萨罗姆"),
                Map.of("perona", "佩罗娜"),
                Map.of("moria", "月光·莫利亚"),
                Map.of("oz", "奥兹"),
                Map.of("lola", "罗拉"),
                Map.of("ryuma", "龙马"),
                Map.of("brook_alive", "布鲁克（生前）"),
                Map.of("shakky", "夏琪"),
                Map.of("rayleigh", "雷利"),
                Map.of("hancock", "波雅·汉库克"),
                Map.of("sandersonia", "波雅·桑达索尼娅"),
                Map.of("marigold", "波雅·玛丽哥鲁德"),
                Map.of("law", "特拉法尔加·罗"),
                Map.of("bepo", "贝波"),
                Map.of("shachi", "夏奇"),
                Map.of("penguin", "佩金"),
                Map.of("kid", "尤斯塔斯·基德"),
                Map.of("killer", "基拉"),
                Map.of("hawkins", "巴兹尔·霍金斯"),
                Map.of("apoo", "斯库拉奇曼·阿普"),
                Map.of("drake", "X·德雷克"),
                Map.of("urouge", "乌尔基"),
                Map.of("bonney", "乔艾莉·波妮"),
                Map.of("caribou", "卡里布"),
                Map.of("coribou", "克里布"),
                Map.of("hody_jones", "霍迪·琼斯"),
                Map.of("zeo", "杰欧"),
                Map.of("daru", "达摩"),
                Map.of("hyouzou", "豹藏"),
                Map.of("dosun", "多森"),
                Map.of("shirahoshi", "白星"),
                Map.of("fukaboshi", "鲨星"),
                Map.of("ryuboshi", "皇星"),
                Map.of("manboshi", "翻车星"),
                Map.of("vander_decken", "范德·戴肯九世"),
                Map.of("wadatsumi", "秃头海怪"),
                Map.of("caesar_clown", "凯撒·库朗"),
                Map.of("monet", "莫奈"),
                Map.of("vergo", "维尔戈"),
                Map.of("buffalo", "巴法罗"),
                Map.of("baby_5", "Baby-5"),
                Map.of("senor_pink", "塞尼奥尔·皮克"),
                Map.of("dellinger", "德林杰"),
                Map.of("gladius", "古拉迪乌斯"),
                Map.of("diamante", "迪亚曼蒂"),
                Map.of("trebol", "托雷波尔"),
                Map.of("sugar", "砂糖"),
                Map.of("pica", "琵卡"),
                Map.of("doflamingo", "多弗朗明哥"),
                Map.of("kyros", "居鲁士"),
                Map.of("rebecca", "蕾贝卡"),
                Map.of("scarlet", "斯卡莱特"),
                Map.of("rikky", "力库王"),
                Map.of("viola", "维奥莱特"),
                Map.of("bartolomeo", "巴托洛米奥"),
                Map.of("gambia", "甘比亚"),
                Map.of("leo", "雷欧"),
                Map.of("tontatta", "小人族"),
                Map.of("sai", "蔡"),
                Map.of("boo", "老蔡"),
                Map.of("hajrudin", "哈鲁丁"),
                Map.of("jeet", "杰特"),
                Map.of("abdullah", "阿布德拉"),
                Map.of("ideo", "伊迪欧"),
                Map.of("blue_gilly", "布鲁基利"),
                Map.of("chinjao", "青椒"),
                Map.of("cavendish", "卡文迪许"),
                Map.of("suleiman", "苏莱曼"),
                Map.of("orlumbus", "奥尔隆布斯"),
                Map.of("mcguy", "麦克盖伊"),
                Map.of("lucky_roux", "拉基·路"),
                Map.of("yasopp", "耶稣布"),
                Map.of("lucky_roo", "拉基·路"),
                Map.of("shanks", "香克斯"),
                Map.of("ben_beckman", "本·贝克曼"),
                Map.of("lucky_rou", "拉基·路"),
                Map.of("rockstar", "洛克之星"),
                Map.of("howling_gab", "嚎叫的加布"),
                Map.of("building_snake", "建筑蛇"),
                Map.of("monster", "怪物"),
                Map.of("van_augur", "范·奥卡"),
                Map.of("doc_q", "毒Q"),
                Map.of("jesus_burgess", "芝沙斯·巴沙斯"),
                Map.of("laffitte", "拉菲特"),
                Map.of("avalo_pizarro", "阿瓦罗·皮萨罗"),
                Map.of("shiryu", "希留"),
                Map.of("vasco_shot", "巴斯克·乔特"),
                Map.of("san_juan_wolf", "圣胡安·恶狼"),
                Map.of("catarina_devon", "卡特琳娜·戴彭"),
                Map.of("kuzan", "库赞"),
                Map.of("sakazuki", "萨卡斯基"),
                Map.of("kizaru", "波鲁萨利诺"),
                Map.of("fujitora", "一笑"),
                Map.of("ryokugyu", "绿牛")
        );
//        return nameMapList;
        return nameMapList;
    }

    @GetMapping("/autoregister")
    public Result autoregister() {
        List<Map<String,String>> nameMapList = getNameList();
        List<String> keyList = new ArrayList<>();
        for (int i = 0; i < nameMapList.size(); i++) {
            Map<String,String> item = nameMapList.get(i);
            String userName = item.keySet().iterator().next();
            if(keyList.contains(userName)){
                continue;
            }
            keyList.add(userName);
            String nickName = item.get(userName);
            RegisterDTO dto = new RegisterDTO();
            dto.setNickName(nickName);
            dto.setPassword("1");
            dto.setUserName(userName);
            userService.register(dto);
        }

        return ResultUtils.success();
    }


    @PutMapping("/modifyPwd")
    @Operation(summary = "修改密码", description = "修改用户密码")
    public Result modifyPassword(@Valid @RequestBody ModifyPwdDTO dto) {
        userService.modifyPassword(dto);
        return ResultUtils.success();
    }

}
